/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bda.mediatheque.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 *
 * @author samsung
 */
@Entity
@Table(name = "boncommande")
@NamedQueries({
    @NamedQuery(name = "Boncommande.findAll", query = "SELECT b FROM Boncommande b")})
public class Boncommande implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id @GeneratedValue(strategy=GenerationType.AUTO)
    @Basic(optional = false)
    @NotNull
    @Column(name = "bonCommandeId")
    private Integer bonCommandeId;
    @JoinColumn(name = "fournisseur", referencedColumnName = "fournisseurId")
    @ManyToOne(optional = false)
    private Fournisseur fournisseur;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bonCommande")
    private List<Lignecommande> lignecommandeList;

    public Boncommande() {
    }

    public Boncommande(Integer bonCommandeId) {
        this.bonCommandeId = bonCommandeId;
    }

    public Integer getBonCommandeId() {
        return bonCommandeId;
    }

    public void setBonCommandeId(Integer bonCommandeId) {
        this.bonCommandeId = bonCommandeId;
    }

    public Fournisseur getFournisseur() {
        return fournisseur;
    }

    public void setFournisseur(Fournisseur fournisseur) {
        this.fournisseur = fournisseur;
    }

    public List<Lignecommande> getLignecommandeList() {
        return lignecommandeList;
    }

    public void setLignecommandeList(List<Lignecommande> lignecommandeList) {
        this.lignecommandeList = lignecommandeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bonCommandeId != null ? bonCommandeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Boncommande)) {
            return false;
        }
        Boncommande other = (Boncommande) object;
        if ((this.bonCommandeId == null && other.bonCommandeId != null) || (this.bonCommandeId != null && !this.bonCommandeId.equals(other.bonCommandeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bda.mediatheque.dao.Boncommande[ bonCommandeId=" + bonCommandeId + " ]";
    }
    
}
